package com.youku.core.view.components
{
   import flash.net.NetConnection;
   import flash.net.NetStream;
   import com.youku.utils.DelayTimer;
   import flash.events.NetStatusEvent;
   import com.youku.P2PConfig;
   
   public class HTTPVideo extends BaseVideo
   {
      
      public function HTTPVideo() {
         super();
      }
      
      override protected function createItems() : void {
         if(_nc)
         {
            _nc.close();
            _nc = null;
         }
         _nc = new NetConnection();
         _nc.connect(null);
         if(_ns)
         {
            CLOSE_BYTES = CLOSE_BYTES + _ns.bytesLoaded;
            _ns.close();
            _ns = null;
         }
         _ns = new NetStream(_nc);
         _ns.bufferTime = EMPTY_BUFFER_TIME;
         _nsObj = new Object();
         _ns.client = _nsObj;
         _delayTimer = new DelayTimer(_ns,_num);
      }
      
      override protected function onNetStatus(param1:NetStatusEvent) : void {
         var _loc2_:* = NaN;
         super.onNetStatus(param1);
         switch(param1.info.code)
         {
            case "NetStream.Buffer.Empty":
               checkInvalidEmpty();
               _loc2_ = _ns.bufferTime;
               _ns.bufferTime = EMPTY_BUFFER_TIME;
               if(_ns.bytesLoaded < _ns.bytesTotal && _ns.bufferLength < P2PConfig.NSBufferEmptyDiff)
               {
                  onBufferEmpty();
               }
               break;
         }
      }
   }
}
